﻿var React = require('react');
var TransactionDetail = React.createClass({

    propTypes: {
        initialData: React.PropTypes.array
    },
    getInitialState: function () {
        return { data: this.props.initialData };
    },

    render: function () {
        var formatDate = function (strTime) {
            var date = new Date(strTime);
            return date.getFullYear() + "-" + (date.getMonth()) + "-" + date.getDate();
        };
        var row = this.state.data.map(function (result) {
            return (
                <tr>
                    <td>{formatDate(result.Oprtime) }</td>
                    <td>{result.Oprxj}</td>
                    <td>{result.Oprxjaft}</td>
                </tr>
            )
        });
        return (
            <div className="page">
                <div className="container">
                    <div className="row-fluid">
                        <h2 className="brow_withoutborder">积分变动</h2>
                    </div>
                     <div class="table-responsive">
                    <table className="table table-bordered table-striped">
                        <thead>
                            <tr>
                                <th className="gridhead">日期</th>
                                <th className="gridhead">金额</th>
                                <th className="gridhead">余额</th>
                            </tr>
                        </thead>
                        <tbody>
                            {row}
                        </tbody>
                    </table>
                     </div>
                </div>
            </div>
        );
    }
});
module.exports = TransactionDetail;


